package app.actions;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JFrame;

/**
 *  Akce zruseni / zavreni dialogoveho okna
 * @author Dejvino
 */
public class CancelAction extends AbstractAction {

    private JFrame frame, parent = null;

    public CancelAction(JFrame frame, JFrame parent){
        this.frame = frame;
        this.parent = parent;
    }

    public void actionPerformed(ActionEvent arg0) {
        if(parent != null)
            parent.setEnabled(true);

        if(frame != null){
            frame.setVisible(false);
            frame.dispose();
        }
    }

}
